找传奇、传世资源到传世资源站!

android 城市选择器 app源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

android 城市选择器 app源码 Android平台开发-第1张package com.zaaach.citypickerdemo;import android.content.Intent;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.TextView;import com.zaaach.citypicker.CityPickerActivity;public class MainActivity extends AppCompatActivity { private static final int REQUEST_CODE_PICK_CITY = 233; private TextView resultTV; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); resultTV = (TextView) findViewById(R.id.tv_result); findViewById(R.id.btn_select).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivityForResult(new Intent(MainActivity.this, CityPickerActivity.class), REQUEST_CODE_PICK_CITY); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_PICK_CITY && resultCode == RESULT_OK){ if (data != null){ String city = data.getStringExtra(CityPickerActivity.KEY_PICKED_CITY); resultTV.setText("当前选择:" city); } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复